resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" {
  name        = "<%= ctx[:vars]['zone_name'] %>"
  dns_name    = "private.example.com."
  description = "Example private DNS zone"
  labels = {
    foo = "bar"
  }

  visibility = "private"

  private_visibility_config {
    networks {
      network_url = google_compute_network.network-1.id
    }
    networks {
      network_url = google_compute_network.network-2.id
    }
  }

  forwarding_config {
    target_name_servers {
      ipv4_address = "172.16.1.10"
    }
    target_name_servers {
      ipv4_address = "172.16.1.20"
    }
  }
}

resource "google_compute_network" "network-1" {
  name                    = "<%= ctx[:vars]['network_1_name'] %>"
  auto_create_subnetworks = false
}

resource "google_compute_network" "network-2" {
  name                    = "<%= ctx[:vars]['network_2_name'] %>"
  auto_create_subnetworks = false
}
